package service.impl;

import mapper.TbItemMapper;
import org.springframework.stereotype.Service;
import pojo.TbItem;
import pojo.TbItemExample;
import service.TestService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TestServiceImpl implements TestService {

    @Resource
    private TbItemMapper tbItemMapper;

    /**
     * 测试用service
     *
     * @param id
     * @return
     */
    @Override
    public TbItem getItemById_Test(long id) {
        TbItemExample tbItemExample = new TbItemExample();
        TbItemExample.Criteria criteria = tbItemExample.createCriteria();
        criteria.andIdEqualTo(id);
        List<TbItem> list = tbItemMapper.selectByExample(tbItemExample);
        if (list != null && list.size() > 0) {
            TbItem tbItem = list.get(0);
            return tbItem;
        }
        return null;
    }

}
